package com.xindaoapp.happypet.utils;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.util.Linkify;
import android.widget.TextView;

/**
 * 对话框创建工具类
 * 
 */
public class DialogUtil {

	/**
	 * 创建进度对话框
	 * @param context
	 * @param content
	 * @return
	 */
	public static Dialog createProgressDialog(Context context, String content) {
		return new CustomProgressDialog(context, content);
	}

	public static AlertDialog createDialog(Context context,
			DialogInterface.OnClickListener positiveClickListener,
			DialogInterface.OnClickListener negativeClickListener, CharSequence title, CharSequence content,
			String positiveButton, String negativeButton) {
		AlertDialog.Builder dialog = new AlertDialog.Builder(context);
		dialog.setTitle(title);
		TextView tv = new TextView(context);
		tv.setTextSize(18);
		tv.setAutoLinkMask(Linkify.WEB_URLS);
		tv.setText(content);
		tv.setClickable(false);
		tv.setPadding(15, 0, 0, 0);
		dialog.setView(tv);
		dialog.setPositiveButton(positiveButton, positiveClickListener);
		dialog.setNegativeButton(negativeButton, negativeClickListener);
		return dialog.create();
	}

}
